var t = require;
var e = module;
var o = exports;
var _n19,
    i =
        (this && this.__extends) ||
        ((_n19 = function n(t, e) {
            return (_n19 =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
        function (t, e) {
            function o() {
                this.constructor = t;
            }
            _n19(t, e), (t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o()));
        }),
    s =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                s = arguments.length,
                r = s < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if (
                "object" == (typeof Reflect === "undefined" ? "undefined" : typeof Reflect) &&
                "function" == typeof Reflect.decorate
            )
                r = Reflect.decorate(t, e, o, n);
            else
                for (var c = t.length - 1; c >= 0; c--) {
                    (i = t[c]) && (r = (s < 3 ? i(r) : s > 3 ? i(e, o, r) : i(e, o)) || r);
                }
            return s > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("BaseUI"),
    c = t("UIEnum"),
    a = t("UIManager"),
    u = t("RankUsersItem"),
    l = cc._decorator,
    d = l.ccclass,
    p = l.property,
    h = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.closeBtn = null),
                (e.bgNode = null),
                (e.rankUserItemPrefab = null),
                (e.rankContent = null),
                (e.regionLabel = null),
                (e.titleLabel = null),
                (e.type = 1),
                e
            );
        }
        return (
            i(e, t),
            (e.prototype.onLoad = function () {
                this.closeBtn.on(
                    cc.Node.EventType.TOUCH_END,
                    function (t) {
                        this.hide(), t.stopPropagation();
                    },
                    this
                ),
                    this.bgNode.on(
                        cc.Node.EventType.TOUCH_END,
                        function (t) {
                            this.hide(), t.stopPropagation();
                        },
                        this
                    );
            }),
            (e.prototype.hide = function () {
                a.UIMgr.hide(c.default.RankUsersUI, !1, !0);
            }),
            (e.prototype.init = function (t) {
                var e = t.users,
                    o = t.region,
                    n = t.count,
                    i = t.type;
                if (((this.type = i), 1 == i)) {
                    var s = o + "学府 " + n + "位进士";
                    (this.regionLabel.string = s), (this.titleLabel.string = "金榜题名");
                } else
                    (s = o + "学府 " + n + "位状元"),
                        (this.regionLabel.string = s),
                        (this.titleLabel.string = "状元及第");
                for (var r = 0; r < e.length; r++) {
                    var c = JSON.parse(e[r]),
                        a = c.nickName,
                        l = c.avatar_url,
                        d = cc.instantiate(this.rankUserItemPrefab);
                    d.getComponent(u.default).init(a, l), this.rankContent.addChild(d);
                }
            }),
            (e.prototype.onShow = function () {
                (this.node.active = !0),
                    (this.node.getChildByName("child").scale = 0),
                    cc.tween(this.node.getChildByName("child")).to(0.2, {scale: 1}).start();
            }),
            (e.prototype.onEnable = function () {}),
            (e.prototype.onDisable = function () {}),
            (e.prototype.update = function () {}),
            s([p(cc.Node)], e.prototype, "closeBtn", void 0),
            s([p(cc.Node)], e.prototype, "bgNode", void 0),
            s([p(cc.Prefab)], e.prototype, "rankUserItemPrefab", void 0),
            s([p(cc.Node)], e.prototype, "rankContent", void 0),
            s([p(cc.Label)], e.prototype, "regionLabel", void 0),
            s([p(cc.Label)], e.prototype, "titleLabel", void 0),
            s([d], e)
        );
    })(r.default);
o.default = h;
